<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
   <title>表单验证</title>	
   <meta http-equiv="content-type" content="text/html; charset=UTF-8">
   <script type="text/javascript" src="js/ajax.js"></script>
   <script type="text/javascript">
      function formcheck(){   
		var url="formcheck";
		
		var params="userid="+document.getElementsByName("userid")[0].value+"&userpwd="+document.getElementsByName("userpwd").item(0).value;
		sendRequest(url,params,'POST',showresult);	
    }
    function showresult(){
        if (xmlHttpRequest.readyState == 4) { 
			if (xmlHttpRequest.status == 200) {
				var info=xmlHttpRequest.responseText;
				alert(info);
				document.getElementById("result").innerHTML = info;
			}
		}
}
</script>
  </head>
  <body> 
    请输入用户名：<input type="text" name="userid" onblur="formcheck()"/><br/>
    请输入密码　：<input type="password" name="userpwd"/><br/>
    <input type="button" value="登录" onclick="formcheck()"/>
    <div id="result"></div>    
  </body>
</html>